package com.zhentao.controller;

import com.zhentao.model.common.buiness.dto.AuditDto;
import com.zhentao.model.common.buiness.dto.MaProductDto;
import com.zhentao.model.common.buiness.pojo.Product;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.MaProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 王越潇
 * @version 1.0
 * @Date 2024/9/15 10:11
 * @Type
 */
@RestController
@RequestMapping("ma/product")
@Api(tags = "maProduct",description = "管理端商品管理接口")
public class MaProductController {
    @Resource
    private MaProductService maProductService;
    @ApiOperation("管理端：商品列表")
    @PostMapping("findProduct")
    public ResponseResult findProduct(@RequestBody MaProductDto maProductDto){
        return maProductService.findProduct(maProductDto);
    }
    @ApiOperation("管理端：按照id查询")
    @GetMapping("findById/{proid}")
    public ResponseResult findById(@PathVariable("proid") Integer proid){
        return maProductService.findById(proid);
    }
    @ApiOperation("管理端：商品审核通过")
    @PostMapping("auditSuccess")
    public ResponseResult auditSuccess(@RequestBody AuditDto auditDto){
        return maProductService.auditSuccess(auditDto);
    }
    @ApiOperation("管理端：商品审核未通过")
    @PostMapping("auditFailure")
    public ResponseResult auditFailure(@RequestBody AuditDto auditDto){
        return maProductService.auditFailure(auditDto);
    }
    @ApiOperation("管理端：上下架")
    @GetMapping("updateStatus/{proid}")
    public ResponseResult updateStatus(@PathVariable("proid") Integer proid){
        return maProductService.updateStatus(proid);
    }
}
